package com.ccrfid.rmc6.repository.asset;

import com.ccrfid.rmc6.entity.asset.AssetEntity;
import com.ccrfid.rmc6.repository.search.SearchableRepository;
import org.springframework.data.repository.Repository;

public interface AssetRepository extends Repository<AssetEntity, Long>, SearchableRepository<AssetEntity> {
    //
    AssetEntity getById(Long id);
    AssetEntity getByCardNumber(Long cardNumber);
    //
    AssetEntity save(AssetEntity entity);
    //
    void deleteById(Long id);
    //
    Boolean existsById(Long id);
    Boolean existsByAssetSn(String assetSn);
    Boolean existsByAssetSnAndIdNot(String assetSn, Long id);
    Boolean existsByCardNumber(Long cardNumber);
    Boolean existsByCardNumberAndIdNot(Long cardNumber, Long id);
}
